<%--
功能: 礼品选择器
--%>
<%@ tag body-content="scriptless"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ attribute name="selectorId" required="true" rtexprvalue="true" type="java.lang.String" description="selector id"%>
<%@ attribute name="callbackFunc" required="true" rtexprvalue="true" type="java.lang.String" description="回调函数，返回参数为JSONObject{it,name}"%>
<%@ attribute name="validateLeaf"  rtexprvalue="true" type="java.lang.Boolean" description="是否限定必须选择叶子目录,默认true"%>

<c:set var="ui_dialog" value="true" scope="request"/>
<fmt:message key="giftCategorySelector.title" var="selectGiftCategoryTitle"/>	
<div id="divDlg${selectorId}" style="visibility:hidden;position:absolute;overflow: auto;">
	<iframe id="${selectorId}Iframe"  name="${selectorId}Iframe" frameborder="0"  width="350" height="370" scrolling="auto">
		<!-- 放置内容 fillDiv -->
	</iframe>
</div>

<script type="text/javascript">

var ui_dialog_${selectorId};
var ${selectorId}Iframe = $j("#${selectorId}Iframe")[0];
var ${selectorId}CallbackFunc = eval(${callbackFunc});;
var ${selectorId}ValidateLeaf = ${empty validateLeaf?true:validateLeaf};
var ${selectorId}HasLoad = false;

$j(document).ready(function(){
	ui_dialog_${selectorId} = $j("#divDlg${selectorId}"); 
}); 

//模拟重写打开dialog方法
function showDialogOf${selectorId}()
{
	if(!${selectorId}HasLoad){
		ui_dialog_${selectorId}.css("visibility","visible");
		${selectorId}Iframe.src =__ctxPath + "/gift/giftCategorySelector/windowPage.html?selectorId=${selectorId}";
		ui_dialog_${selectorId}.dialog({ title:"${selectGiftCategoryTitle}", resizable:false,autoResize:false,modal: true, height:400, width:350, bgiframe: true,overlay: { opacity: 0.5, background: "black" } });
		${selectorId}HasLoad = true;
	}
	ui_dialog_${selectorId}.dialog("open");
	
}

//模拟重写关闭dialog方法
function closeDialogOf${selectorId}()
{
	ui_dialog_${selectorId}.dialog("close");
}

</script>

